package com.deluxelx.soul.inn.common.constant;

import cn.hutool.core.util.StrUtil;
import com.deluxelx.soul.inn.common.param.CollectedParam;

import static com.deluxelx.soul.inn.common.constant.UserConstant.USER_CACHE_KEY_PREFIX;

/**
 * 课程常数
 *
 * @author liaozihao
 * @date 2024-04-16 15:36
 */
public class CourseConstant {

    public static final String COURSE_CACHE_KEY_PREFIX = "course_";

    public static final Integer COURSE_CACHE_EXPIRE_TIME = 60 * 60 * 24 * 7;

    public static final String COURSE_FOLLOW_KEY = "followCourse";

    public static final String COURSE_PLAY_KEY = "playCourse";

    public static final String courseTaskPattern1 = "user_*:course_*";

    public static final String courseTaskPattern2 = "followCourse:*";

    public static final String courseTaskPattern3 = "playCourse:*";

    public static String buildFollowCourseKey(CollectedParam param) {
        return USER_CACHE_KEY_PREFIX + param.getUserId() + StrUtil.COLON + COURSE_CACHE_KEY_PREFIX + param.getCourseId();
    }

    public static String buildFollowCourseKey(String courseId) {
        return COURSE_FOLLOW_KEY + StrUtil.COLON + courseId;
    }

    public static String buildPlayCourseKey(String courseId) {
        return COURSE_PLAY_KEY + StrUtil.COLON + courseId;
    }

}
